const { SuccessModel } = require("../utils/resModel")
const path = require("path")

class HomeCtl {
    upload(ctx) {
        const file = ctx.request.files.file.path
        const basename = path.basename(file)
        ctx.body = new SuccessModel({ url: `${ctx.origin}/uploads/${basename}` })
    }
}

module.exports = new HomeCtl()